package com.service.impl;

import com.entity.Department;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mapper.DepartmentMapper;
import com.service.DepartmentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.utils.PageObject;
import com.vo.DepartmentVO;
import com.vo.ReportVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  部门服务实现类
 * </p>
 *
 * @author aiou
 * @since 2025-06-12
 */
@Service
public class DepartmentServiceImpl implements DepartmentService {

    @Autowired
    private DepartmentMapper departmentMapper;

    //部门列表
    @Override
    public List<Department> list() {
        return departmentMapper.list();
    }

    //部门管理：分页查询
    @Override
    public List<DepartmentVO> departmentList() {
        return departmentMapper.listDepartMentVO();
    }

    //部门管理-保存
    @Override
    public boolean save(Department department) {
        return departmentMapper.insert(department);
    }

    //部门管理-修改
    @Override
    public boolean updateById(Department department) {
        return departmentMapper.updateById(department);
    }

    //部门管理-查找部门信息
    @Override
    public Department getById(Integer id) {
        return departmentMapper.getById(id);
    }

    //部门管理-删除
    @Override
    public boolean removeById(Integer id) {
        return departmentMapper.deleteById(id);
    }


    @Override
    public List<Department> list(Integer id) {
        return departmentMapper.selectByParentId(id);
    }
}
